class SlidingWindow {
	public int minSubArrayLen(int target, int[] nums) {
		int i = 0;
		int result = Integer.MAX_VALUE;
		int sum = 0;
		for(int j = 0 ; j < nums.length ; j++){
			sum += nums[j];
			while(sum >= target){
				int length = j - i + 1;
				result = Integer.min(length,result);
				sum -= nums[i];
				i++;
			}
		}
		return result == Integer.MAX_VALUE ? 0:result;
	}
}